package com.kidback.bbloc259.util;

import android.widget.Toast;

import com.kidback.bbloc259.app.KidApplication;


/**
 * Created by meikai on 2020/06/02.
 */
public class ToastUtils {

    public static void show(String msg) {
        showS(msg);
    }

    public static void showL(String msg) {
        if (ThreadUtils.isMainThread()) {
            Toast.makeText(KidApplication.getInstance(), msg, Toast.LENGTH_LONG).show();
        } else {
            ThreadUtils.postUI(() -> {
                Toast.makeText(KidApplication.getInstance(), msg, Toast.LENGTH_LONG).show();
            });
        }
    }

    public static void showS(String msg) {
        if (ThreadUtils.isMainThread()) {
            Toast.makeText(KidApplication.getInstance(), msg, Toast.LENGTH_SHORT).show();
        } else {
            ThreadUtils.postUI(() -> {
                Toast.makeText(KidApplication.getInstance(), msg, Toast.LENGTH_SHORT).show();
            });
        }
    }

}
